package com.carb.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.carb.enums.CommonDeleted;
import com.carb.enums.UserGender;
import com.carb.enums.UserRole;
import com.carb.enums.CommonStatus;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 用户实体类
 * </p>
 *
 * @author XuChaoyang
 * @since 2025-01-18
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("tb_user")
@Schema(description = "用户表")
public class User implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;
    
    @Schema(description = "用户id")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @Schema(description = "用户名")
    private String username;

    @Schema(description = "密码")
    private String password;

    @Schema(description = "姓名")
    private String name;

    @Schema(description = "性别 (女, 男)")
    private UserGender gender;

    @Schema(description = "年龄")
    private Integer age;

    @Schema(description = "移动电话")
    private String mobilePhone;

    @Schema(description = "身份证号码")
    private String idNumber;

    @Schema(description = "电子邮箱")
    private String email;

    @Schema(description = "地址")
    private String address;

    @Schema(description = "头像链接")
    private String avatarUrl;

    @Schema(description = "用户状态 (禁用, 启用)")
    private CommonStatus status;

    @Schema(description = "用户角色 (管理员, 员工, 会员)")
    private UserRole role;

    @Schema(description = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @Schema(description = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    @Schema(description = "上次登录时间")
    private LocalDateTime lastLoginTime;

    @Schema(description = "逻辑删除 (未删除, 已删除)")
    private CommonDeleted deleted;

}
